/**
 * 将左侧序列看成一个有序序列，每次将一个数字插入该有序序列。插入时，从有序序列最右侧开始比较，若比较的数较大，后移一位。
 */
function sort1(array) {
    for (let i = 1; i < array.length; i++) {
        let target = i;
        for (let j = i - 1; j >= 0; j--) {
            if (array[target] < array[j]) {
                [array[target],array[j]] = [array[j],array[target]];
                target = j;
            } else {
                break;
            }
        }
    }
    return array;
}

let arr = [3,2,5,4,8];
console.log(sort1(arr));
let priList = [
    {
        id: null,
        creator: null,
        createTime: null,
        updateTime: null,
        privilegeId: "8SgR63tn0D5OTTnquLAKzZBcC",
        privilegeName: "系统管理",
        code: "SYS_XTGL",
        description: null,
        targetId: "3ZfyyFUFzRg00dyy2rf38a1o0",
        url: "/system",
        style: "gear-b",
        roleId: "140SFUHoqWwsgmPFZ3AdzWLas",
        childPrivilege: [
            {
                id: null,
                creator: null,
                createTime: null,
                updateTime: null,
                privilegeId: "zBq1YcahPOtbRrpPKCLwTGh5M",
                privilegeName: "菜单管理",
                code: "SYS_XTGL_CDGL",
                description: null,
                targetId: "XMIpt5i9U84MMmR9WPctct4Py",
                url: "/system/menu",
                style: "",
                roleId: null,
                childPrivilege: null
            },
            {
                id: null,
                creator: null,
                createTime: null,
                updateTime: null,
                privilegeId: "7EsF4vUiTK8tz58xFHuh6H4mV",
                privilegeName: " 标注点类型管理",
                code: "SYS_XTGL_BZDLXGL",
                description: null,
                targetId: "OePPSouYXYFUJHvmFE8QkH7oZ",
                url: "/system/mark",
                style: "",
                roleId: null,
                childPrivilege: null
            }
        ]
    },
    {
        id: null,
        creator: null,
        createTime: null,
        updateTime: null,
        privilegeId: "zBq1YcahPOtbRrpPKCLwTGh5M",
        privilegeName: "菜单管理",
        code: "SYS_XTGL_CDGL",
        description: null,
        targetId: "XMIpt5i9U84MMmR9WPctct4Py",
        url: "/system/menu",
        style: "",
        roleId: null,
        childPrivilege: null
    }
]
